package com.aaa.sbms.controller;

import com.aaa.sbms.service.EmpCheckInService;
import com.aaa.sbms.util.SessionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.Map;

@RestController
@RequestMapping("ecic")
public class EmpCheckInController {

    @Autowired
    private EmpCheckInService empCheckInService;

    @RequestMapping("empList")
    public  Object list(@RequestParam Map map){
        return empCheckInService.getList(map);
    };

    @RequestMapping("updateIng")
    public Object updateIng(Integer userid) { return empCheckInService.updateIng(userid);};

    @RequestMapping("floorList")
    public Object getFloorList(@RequestParam Map map){
        return empCheckInService.getFloor(map);
    }

    @RequestMapping("roomList")
    public Object getRoomList(@RequestParam Map map){
        return empCheckInService.getRoom(map);
    }

    @RequestMapping("del")
    public Object delRoom(@RequestBody Map map, HttpSession session){
        map.put("userName", SessionUtil.getUserName());
        return empCheckInService.delBedCount(map);
    };

    @RequestMapping("insert")
    public Object insert(@RequestBody Map map, HttpSession session){
        map.put("userName", SessionUtil.getUserName());
        return empCheckInService.add(map);}
}
